<template>
    <div class="copyWrap">
        <a-button @click="handClick" v-if="id" :loading="loading">复制</a-button>
    </div>
</template>
<script>
export default {
    name: '',
    props: {
        id: {
            type: [Number, String],
        }
    },
    data() {
        return {
            loading: false,
        }
    },
    methods: {
        handClick() {
            let params = {
                id: this.id,
            };
            this.loading = true;
            this.getAxios(this.$copyAddDayFormDataXL, params)
                .then((res) => {
                    if (res.code == 200) {
                        this.$message.success({
                            content: res.msg || res.data,
                            duration: 2.5,
                        });
                    } else {
                        this.$message.error({
                            content: res.msg || '操作失败',
                            duration: 2.5,
                        });
                    }
                })
                .catch(() => { })
                .finally(() => {
                    this.loading = false;
                });
        }
    }
}
</script>